package com.loong.rpc;

import com.loong.rpc.common.ServiceURL;
import com.loong.rpc.protocol.HttpServer;
import com.loong.rpc.register.LocalRegister;
import com.loong.rpc.register.RemoteRegister;
import com.loong.rpc.service.HelloService;
import com.loong.rpc.service.impl.HelloServiceImpl;

public class Provider {

    public static void main(String[] args) {
        // 本地注册
        LocalRegister.regist(HelloService.class.getName(), HelloServiceImpl.class);

        // 注册中心注册
        ServiceURL url = new ServiceURL("localhost", 8080);
        RemoteRegister.regist(HelloService.class.getName(), url);

        // Tomcat服务器
        HttpServer httpServer = new HttpServer();
        httpServer.start(url.getHostname(), url.getPort());
    }

}
